package com.cty;

import java.io.FileNotFoundException;
import java.io.FileReader;
import java.io.FileWriter;
import java.io.IOException;
import java.util.Properties;

/*
*
* 做一个案例将users.txt中的李方的年龄改为18岁
*
* */
public class example01 {
    public static void main(String[] args) throws IOException {
        Properties properties = new Properties();
        properties.load(new FileReader("src/users.txt"));
        if(properties.containsKey("李方")){
            properties.setProperty("李方","18");
        }
        properties.store(new FileWriter("src/users.txt"),"end");
        System.out.println("修改成功");
    }
}
